
//------------------------------------------------------------------------------

using Apps.Models;
using Apps.Models.CONTRACT;
using Apps.IDAL.CONTRACT;
using System;
using System.Linq;

namespace Apps.DAL.CONTRACT
{
	public partial class CONTRACT_DETAILRepository:BaseRepository<CONTRACT_DETAIL>,ICONTRACT_DETAILRepository,IDisposable
	{
	    public CONTRACT_DETAILRepository(DBContainer db):base(db)
        {
        
        }

        public IQueryable<CONTRACT_DETAILModel> QueryList(string ContractID)
        {
            IQueryable<CONTRACT_DETAILModel> list = from a in Context.CONTRACT_DETAIL
                                                    where a.CONTRACT_ID == ContractID
                                                    orderby a.CONTRACT_TERM ascending
                                                    select new CONTRACT_DETAILModel()
                                                    {
                                                        ARRIVAL_ADDRESS = a.ARRIVAL_ADDRESS,
                                                        ARRIVAL_DATE = a.ARRIVAL_DATE,
                                                        ContractName = a.CONTRACT_INFO.NAME,
                                                        CONTRACT_DETAIL_ID = a.CONTRACT_DETAIL_ID,
                                                        CONTRACT_ID = a.CONTRACT_ID,
                                                        CONTRACT_TERM = a.CONTRACT_TERM,
                                                        COUNT = a.COUNT,
                                                        MATERIEL_ID = a.MATERIEL_ID,
                                                        MATERIEL_NAME=a.PUB_MATERIEL.MATERIEL_NAME,
                                                        MINE_ID = a.MINE_ID,
                                                        MINE_NAME = a.PUB_MINE.MINE_NAME,
                                                        PLAN_NO = a.PLAN_NO,
                                                        PRICE = a.PRICE,
                                                        PRICE_TYPE = a.PRICE_TYPE,
                                                        RELATION_PLAN_ID = a.RELATION_PLAN_ID,
                                                        RELATION_PLAN_TYPE = a.RELATION_PLAN_TYPE,
                                                        SHIP_NAME = a.SHIP_NAME,
                                                        VOYAGE_NO = a.VOYAGE_NO
                                                    };
            return list;
        }
    }
}
